#ifndef SRC_TEST_CONTROLLER_CONFIG_H_
#define SRC_TEST_CONTROLLER_CONFIG_H_

#include <vector>
#include "base/common.h"
#include "base/noncopyable.hpp"

class Config : public noncopyable,
  public std::enable_shared_from_this<Config> {
 public:
  typedef std::shared_ptr<Config> Ptr;
  Config();
  virtual ~Config();

 public:
  struct PDNS {
    std::string ip;
    int port;
  };

  struct SSH {
    std::string sn;
    int port;
    std::string username;
    std::string password;
  };

  struct DeviceTask {
    int device_count;
  };

  struct ClientTask {
    int device_id;
    int device_range_min;
    int device_range_max;
  };

  struct DeviceHost {
    int id;
    std::string workpath;
    std::string system;
    struct SSH ssh;
    struct DeviceTask task;
  };

  struct ClientHost {
    int id;
    std::string workpath;
    std::string system;
    struct SSH ssh;
    std::vector<struct ClientTask> tasks;
  };

 public:
  bool Parse(const std::string &filename);

  PDNS pdns() const;

  int duration_seconds() const;

  std::vector<DeviceHost> device_hosts() const;

  std::vector<ClientHost> client_hosts() const;

 private:
  PDNS pdns_;
  int duration_seconds_;
  std::vector<DeviceHost> device_hosts_;
  std::vector<ClientHost> client_hosts_;
};

#endif  // SRC_TEST_CONTROLLER_CONFIG_H_
